import type { IColumnsOption } from 'vc';
import { INDEX, COMPANY_NAME, BUSINESS_DATA, REGISTERED_CAPITAL, PROVINCE, CITY, COUNTRY, INDUSTRY_CATEGORY, INFO_SOURCE, TAG_YEAR } from '@/utils/tableColumn';

export function useTable() {
  const columns = ref<IColumnsOption[]>([
    { ...INDEX },
    { ...COMPANY_NAME },
    {
      title: '披露日期',
      field: 'noticeDate',
      width: 110,
      align: 'center',
      sortable: true
    },
    {
      ...INFO_SOURCE('catalogueName'),
      field: 'catalogueName'
    },
    {
      ...TAG_YEAR,
      sortable: true,
      field: 'statisticalYear'
    },
    {
      title: '技术领域',
      minWidth: 150,
      field: 'technologyField',
      sortable: true,
      showOverflow: 'title'
    },
    {
      minWidth: 220,
      field: 'technology',
      title: '技术名称',
      sortable: true,
      showOverflow: 'title'
    },
    {
      minWidth: 300,
      field: 'technologyIntroduction',
      title: '技术简介',
      showOverflow: 'title',
      cellRender: { name: 'Clamp' }
    },
    {
      minWidth: 300,
      field: 'mainPerformanceIndex',
      title: '技术指标',
      showOverflow: 'title',
      cellRender: { name: 'Clamp' }
    },
    {
      minWidth: 300,
      field: 'technologyApplicationRange',
      title: '适用范围',
      showOverflow: 'title',
      cellRender: { name: 'Clamp' }
    },
    {
      minWidth: 220,
      field: 'evaluationAuthority',
      title: '发布单位',
      sortable: true
    },
    { ...PROVINCE },
    { ...CITY },
    { ...COUNTRY },
    { ...INDUSTRY_CATEGORY },
    { ...BUSINESS_DATA },
    { ...REGISTERED_CAPITAL }
  ]);

  return {
    columns
  };
}
